package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.pojo.db1.LineBaseBigType;
import com.sailfish.springbootdemo.pojo.db1.LineTechBigType;
import com.sailfish.springbootdemo.service.db1.LineBaseBigTypeService;
import com.sailfish.springbootdemo.service.db1.LineTechBigTypeService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/lineTechBigType")
public class LineTechBigTypeController {

    @Autowired
    private LineTechBigTypeService lineTechBigTypeService;

    @PostMapping("/getAllLineTechBigType")
    public Result getAllLineTechBigType(String searchValue) {
        try {
            return ResultUtil.success(lineTechBigTypeService.getAllLineTechBigType(searchValue));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.error(500, e.getMessage(), e.getMessage(), null);
        }
    }

    @PostMapping("/addOrUpdateLineTechBigType")
    public Result addOrUpdateLineTechBigType(LineTechBigType lineTechBigType, String mode) {
        return lineTechBigTypeService.addOrUpdateLineTechBigType(lineTechBigType, mode);
    }

    @PostMapping("/deleteLineTechBigType")
    public Result deleteLineTechBigType(Integer lineTechBigTypeId) {
        return lineTechBigTypeService.deleteLineTechBigType(lineTechBigTypeId);
    }
}
